package com.datawin.taotaocheche.util;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;

import com.datawin.taotaocheche.R;


public class TimerUtil extends CountDownTimer{

    private TextView textView;
    public TimerUtil(long millisInFuture, long countDownInterval, View v) {
        super(millisInFuture, countDownInterval);
        this.textView = (TextView) v;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        textView.setClickable(false);
        textView.setBackgroundResource(R.drawable.register_check_bg);
        textView.setTextColor(Color.BLACK);
        textView.setText(millisUntilFinished/1000+"s后重新发送");

    }

    @Override
    public void onFinish() {
        textView.setClickable(true);
        textView.setText("重新发送");
        textView.setTextColor(Color.WHITE);
        textView.setBackgroundResource(R.drawable.get_code_true);
    }
}
